# Makefile for rabbitos
# liuw@liuw.name
# 05-Aug-08
LD	= ld
RM	= rm -f
TAGSPROG= ctags #change this according to you preferrence
LDFLAGS	= -Tlink.ld -M -s -x
ASFLAGS = -felf

# remember to update the link target
DIRS	= mm kernel init boot fs lib

all: link

clean:
	for d in $(DIRS); \
	do \
	$(MAKE) --directory=$$d clean; \
	done;
	$(RM) kernel.img System.map

objs:
	for d in $(DIRS); \
	do \
	$(MAKE) --directory=$$d build; \
	done;
link: objs 
# boot.o MUST go first! so I hardcoded it here
	$(LD) $(LDFLAGS) -o kernel.img boot/*.o \
		mm/*.o kernel/*.o init/*.o lib/*.o \
		> System.map


# generate tags file
TAGS:
	$(TAGSPROG) -R

